//
//  SPCMSServiceConfig.m
//  BaseProject
//
//  Created by Sailer Guo on 2019/12/27.
//  Copyright © 2019 Beijing Shopin Retail Development Co., Ltd. All rights reserved.
//

#import "SPCMSServiceConfig.h"
#import "ServiceConfigProtocol.h"

@interface SPCMSServiceConfig ()

@property (nonatomic,strong,readwrite) NSDictionary *h5PageMap;

@end

@implementation SPCMSServiceConfig 

+ (id<ServiceConfig>)serviceConfigWith:(EnvironmentType)env {
    switch (env) {
        case Local:
            return [self localServiceConfig];
            break;
        
        case Development:
            return [self developmentServiceCofig];
            
        case Production:
            return [self productionServiceConfig];
            break;
        default:
            NSAssert(NO, @"Unknown Env");
            return nil;
            break;
    }
}

+ (id<ServiceConfig>)productionServiceConfig {
    SPCMSServiceConfig *serviceConfig = [[SPCMSServiceConfig alloc] init];
    serviceConfig.baseUrl = @"https://app.shopin.cn/cms/";
    serviceConfig.h5PageMap = @{
        @(SPH5PageLottery):@"https://app.shopin.cn/cms/activity/members.html",
        @(SPH5PageNewCustomer):@"https://app.shopin.cn/cms/activity-xinke.html"
    };
    
    return serviceConfig;
}

+ (id<ServiceConfig>)localServiceConfig {
    SPCMSServiceConfig *serviceConfig = [[SPCMSServiceConfig alloc] init];
    serviceConfig.baseUrl = @"http://192.168.110.178:10480/";
    serviceConfig.h5PageMap = @{
        @(SPH5PageLottery):@"https://app.shopin.cn/cms/activity/members.html",
        @(SPH5PageNewCustomer):@"https://app.shopin.cn/cms/activity-xinke.html"

    };
    return serviceConfig;
}

+ (id<ServiceConfig>)developmentServiceCofig {
    SPCMSServiceConfig *serviceConfig = [[SPCMSServiceConfig alloc] init];
    serviceConfig.baseUrl = @"http://192.168.110.178:10480/";
    serviceConfig.h5PageMap = @{
        @(SPH5PageLottery):@"https://app.shopin.cn/cms/activity/members.html",
        @(SPH5PageNewCustomer):@"https://app.shopin.cn/cms/activity-xinke.html"
    };
    return serviceConfig;
}

@synthesize baseUrl;

@synthesize env;

@synthesize session;

@synthesize baseImageUrl;

@end
